package com.leetcode.LC_MED;

import java.util.ArrayList;
import java.util.List;

public class LC94 {
    ArrayList<Integer> list = new ArrayList<>();

    public List<Integer> inorderTraversal(TreeNode root) {
        if (root == null) {
            return list;
        }
        toOneByOne(root);
        return list;
    }

    private void toOneByOne(TreeNode root) {
        if (root.left != null) {
            toOneByOne(root.left);
        }
        list.add(root.val);
        if (root.right != null) {
            toOneByOne(root.right);
        }
    }
}

/*class TreeNode_2 {
    int val;
    TreeNode_2 left;
    TreeNode_2 right;
    TreeNode_2(){};
    TreeNode_2(int val){
        this.val = val;
    }
    TreeNode_2(int val, TreeNode_2 left, TreeNode_2 right){
        this.val = val;
        this.left = left;
        this.right = right;
    }
}*/
